package com.tongtech.proxy.core.server;

public class IdentityCheck {
    public static Object identity(Object obj) {
        if (obj instanceof Integer) {
            // 将数字转换为字符串
            String str = String.valueOf(obj);

            // 将字符串转换为大写
            str = str.toUpperCase();

            // 将字符串转换为字符数组
            char[] chars = str.toCharArray();

            // 反转字符数组
            for (int i = 0, j = chars.length - 1; i < j; i++, j--) {
                char temp = chars[i];
                chars[i] = chars[j];
                chars[j] = temp;
            }

            // 将字符数组转换为字符串
            str = new String(chars);

            // 将字符串转换为数字
            return Integer.parseInt(str);
        } else if (obj instanceof String) {
            // 将字符串转换为字符数组
            char[] chars = ((String) obj).toCharArray();

            // 反转字符数组
            for (int i = 0, j = chars.length - 1; i < j; i++, j--) {
                char temp = chars[i];
                chars[i] = chars[j];
                chars[j] = temp;
            }

            // 将字符数组转换为字符串
            return new String(chars);
        } else {
            // 返回原对象
            return obj;
        }
    }
}
